package com.letv.app.ljodfh.ui.adapter.holder;

import android.content.Context;
import android.view.View;

import com.jiongbull.jlog.JLog;
import com.letv.app.ljodfh.R;
import com.letv.app.ljodfh.beans.FChannel;
import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Liuyu on 2018/3/23.
 */

public class HomeTvChannelHolder extends BaseRecylerHolder<FChannel> {

    @BindView(R.id.tv_tv_name)
    CustomFontTextView tvName;
    @BindView(R.id.tv_tv_living)
    CustomFontTextView tvMode;

    public HomeTvChannelHolder(Context context, View itemView) {
        super(context, itemView);
        ButterKnife.bind(this, itemView);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                doInternalClick(v);
            }
        });

    }

    @Override
    protected void initInject() {
//        super.initInject();
    }

    @Override
    public void setData(FChannel fChannel) {
        if (fChannel == null) {
            return;
        }
        tvName.setText(fChannel.getChannelName());
    }

    @Override
    public void setData(FChannel fChannel, int position, boolean isSelected) {
        JLog.e("oopoa is selected=" + isSelected + "  pos=" + position + "  self pos=" + getAdapterPosition());
        super.setData(fChannel, position, isSelected);
        tvMode.setVisibility(isSelected ? View.VISIBLE : View.INVISIBLE);
    }

    @Override
    public HomeTvChannelHolder setInternalClick(OnItemInternalClick internalClick) {
        super.setInternalClick(internalClick);
        return this;
    }
}
